﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Data.SqlClient;
using System.Data;

/// <summary>
/// Summary description for AdminDAL
/// </summary>
public class AdminDAL
{
    DataAccess acc = new DataAccess();
    
	public AdminDAL()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    internal DataTable isValidLogin(string user, string pass)
    {
        SqlParameter[] paraList = new SqlParameter[2];
        paraList[0] = new SqlParameter("@UserName", SqlDbType.NVarChar,50);
        paraList[0].Value = user;
        paraList[1] = new SqlParameter("@Password", SqlDbType.NVarChar, 50);
        paraList[1].Value = pass;
        return acc.executeSelect("validLoginAdmin", paraList);
        
    }

    internal bool updatePassword(int id, string password)
    {
        SqlParameter[] paraList = new SqlParameter[2];
        paraList[0] = new SqlParameter("@ID", SqlDbType.Int);
        paraList[0].Value = id;
        paraList[1] = new SqlParameter("@Password", SqlDbType.NVarChar, 50);
        paraList[1].Value = password;
        int check = acc.executeModifier("updateAdmin", paraList);
        if (check > 0)
        {
            return true;
        }
        else
        {
            return false;
        }
    }
}